<template>
  <div>正在打开页面</div>
</template>

<script lang="ts">
import { defineComponent } from 'vue'
import iRedirect from 'src/api/redirect'

interface Topic {
  // 基础信息
  _id: string, // ID

  name: string, // 名称
  description: string, // 介绍

  // 专题包含标签
  tags: string[], // 专题包含一级标签

  isFollow: boolean,

  // 数据信息
  createdAt: Date, // 创建时间
  updatedAt: Date, // 更新时间
}

export default defineComponent({
  name: 'Topic',
  components: {
  },
  data (): {
    topics: Topic[],
    topicName: string,
    keywords: string,
    orderBy: string,
    orderOptions: string[],
  } {
    return {
      topics: [],
      topicName: '',
      keywords: '',
      orderBy: '最新发布',
      orderOptions: [
        '最新发布', '点赞最多', '热度趋势'
      ]
    }
  },
  async mounted () {
    const to = this.$route.params.to
    const data = await iRedirect.getRedirection({ to: to })
    window.open(data.redirection, '_self')
  },
  methods: {
  }
})
</script>

<style lang="scss">
.topic {
  width: 1160px;
  margin: 0 auto;
}
</style>
